// A user item in a dialog
// An example of placing a user item in a modal dialog
// Make sure that the user item in the dialog is enabled.
// Assumes inclusion of
#include
void ToolBoxInit (void);
void DialogInit (void);
pascal void myItem (WindowPtr theWindow, short itemNo); void MainLoop (void);
main ()
{
ToolBoxInit ();
DialogInit ();
MainLoop ();
}
void ToolBoxInit ()
{
}
pascal void myItem (WindowPtr theWindow, short itemNo) {
beginPoint.h = gButtonRect.left + (gButtonRect.right - gButtonRect.left)/2
beginPoint.v = gButtonRect.top + (gButtonRect.bottom - gButtonRect.top)/2 + (fInfo.ascent)/2;
MoveTo (beginPoint.h, beginPoint.v); }
void DialogInit ()
{
short itemType;
if (gTheDialog) {
GetDItem ( gTheDialog, 1, &itemType, &itemHandle, &itemRect ); gButtonRect = itemRect;
}
else
exit (1);
}
void MainLoop ()
{
short itemHit;
{
switch (itemHit) {
case 1:
break;
}
}
}
/* A Rez description file for the 'DLOG' and 'DITL' resources used by the User Item
* example above
*/
#include "Types.r
resource 'DLOG' (128) {
{40, 40, 240, 280},
dBoxProc,
invisible,
noGoAway,
0x0,
128,
};
resource 'DITL' (128) {
{ /* array DITL array: 1 elements */
/* [1] */
{80, 79, 120, 161},
UserItem {
enabled
}
}
};